import org.rest.*;

class BootStrap {
	
	def init = { servletContext ->
		
		def supp1=new Suppliers(name:"name1",
								contactName:"contactName1",
								contactTitle:"contactTitle1",
								address:"address1",
								city:"city1",
								region:"region1",
								postalCode:"postalCode1",
								country:"country1",
								phone:"phone1",
								fax:"fax1",
								homePage:"homePage1").save(flush:true)
		
		def supp2=new Suppliers(name:"name2",
								contactName:"contactName2",
								contactTitle:"contactTitle2",
								address:"address2",
								city:"city2",
								region:"region2",
								postalCode:"postalCode2",
								country:"country2",
								phone:"phone2",
								fax:"fax2",
								homePage:"homePage2").save(flush:true)			
		
		def cat1 = new Categories(name:"name1",
								  description:"description1").save(flush:true)
		

	    def cat2 = new Categories(name:"name2",
	    						  description:"description2").save(flush:true)
		
		
//Suppliers supplier
//Categories category
	    def prod1 =	 new Product (name:"name1",
	    						   quantityPerUnit:1,
	    						   unitPrice:10,
	    						   category:cat1,
	    						   supplier:supp1,
	    						   unitInStock:1,
	    						   unitOnOrders:1).save(flush:true)
		
	    def prod2 =	 new Product (name:"name2",
									quantityPerUnit:2,
									unitPrice:10,
		    						category:cat2,
		    						supplier:supp2,
									unitInStock:2,
									unitOnOrders:2).save(flush:true)
		
	}
	def destroy = {
	}
} 